<Project DefaultTargets="Build">
  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

  <PropertyGroup>
    <PackageDescription>Provides the tasks+targets, for consumption by mono-based workloads</PackageDescription>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="$(RepoTasksDir)MonoTargetsTasks\MonoTargetsTasks.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
    <PackageFile Include="Sdk\Sdk.targets" TargetPath="Sdk" />
    <PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
    <PackageFile Include="..\..\msbuild\common\RuntimeComponentManifest.targets" TargetPath="Sdk" />
  </ItemGroup>

  <Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles">
    <PropertyGroup>
      <MonoTargetsTasksPropsPath>$(IntermediateOutputPath)MonoTargetsTasks.props</MonoTargetsTasksPropsPath>
    </PropertyGroup>

    <ItemGroup>
      <_ReplacementValue Include="NetCoreAppToolCurrent" Value="$(NetCoreAppToolCurrent)" />
      <_ReplacementValue Include="NetFrameworkToolCurrent" Value="$(NetFrameworkToolCurrent)" />
    </ItemGroup>

    <GenerateFileFromTemplate
      TemplateFile="Sdk/MonoTargetsTasks.props.in"
      Properties="@(_ReplacementValue->'%(Identity)=%(Value)')"
      OutputPath="$(MonoTargetsTasksPropsPath)" />

    <ItemGroup>
      <PackageFile Include="$(MonoTargetsTasksPropsPath)" TargetPath="Sdk" />
    </ItemGroup>
  </Target>

  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
